#!/usr/bin/env python

import sys
from array import array

def gerador(tam,amp):
    i = 1
    while tam>0:
        yield i
        i += 1
        i %= (amp+1)
        if i == 0: i = 1
        tam -= 1

tam = int(sys.argv[1])
amp = int(sys.argv[2])
buffer = array('B',gerador(tam,amp))
arq_saida = file('ent_%s_%s.bin'%(tam,amp),'w')
buffer.tofile(arq_saida)
arq_saida.close()
print '%s x %s' % (len(buffer), buffer.itemsize)
